<?php
namespace app\index\model;

use think\Model;

class Article extends Model{

    protected $insert = ['intime','ip'];

    protected function setIntimeAttr($value){
        return time();
    }

    protected function setIpAttr($value){
        return request()->ip();
    }


    public function getStateAttr($value){
        $state = [0 => '无效', 1 => '有效'];
        return $state[$value];
    }

    public function setTitleAttr($value,$data){
        return $value.'不错';
    }

}
?>